1 <?php
2 ob_start();
3 session_start();
4 include(
"header.php");
5 include(
"sidebar.php");
6 //
7 //
if(isset($_SESSION[empid]))
8 // {
9 // header(
"Location: empaccount.php");
10 // }
11 //
if(isset($_SESSION[custid]))
12 // {
13 // header(
"Location: account.php");
14 // }

15 ?>
16
17 <script type=
"text/javascript">
18 function validate()
19 {
20     
if(document.form1.loginid.value=="")
21     {
22         alert(
"Enter Login ID");
23         document.form1.loginid.focus();
24         
return false;
25     }
26     
if(document.form1.password.value=="")
27     {
28         alert(
"Enter Password");
29         document.form1.loginid.focus();
30         
return false;
31     }
32 }
33 </script>
34
35
36 <?php
37 include(
"dbconnection.php");
38
39
40 if
(isset($_POST[submit]))
41 {
42
43     $result = mysql_query(
"SELECT * FROM customer where emailid='$_POST[loginid]' AND password='$_POST[password]'");
44
45     
if(mysql_num_rows($result) == 1)
46     {
47
48         
while($row = mysql_fetch_array($result))
49         {
50             $_SESSION[custid] = $row[custid];
51         }
52
53
54         header(
"Location: account.php");
55     }
56     
else
57     {
58         $logres =
"Invalid User ID and password entered..";
59
60     }
61
62
63 }
64
65
66
67
68 ?>
69
70 <div id=
"main">
71
72     <a name=
"TemplateInfo"></a>
73     <h1>Customer Login</h1>
74     <p>Please enter Login ID/ Email ID and Password to login website. </p>
75     <form id=
"form1" name="form1" method="post" action="login.php" onsubmit="return validate()">
76         <table width=
"466" height="109" border="0">
77             <tr>
78                 <th colspan=
"2" scope="row"><font color="#FF0000"><b><?php echo $logres; ?></b></font></th>
79             </tr>
80             <tr>
81                 <th scope=
"row">Login ID</th>
82                 <td><input name=
"loginid" type="text" id="loginid" size="30" /></td>
83             </tr>
84             <tr>
85                 <th scope=
"row">Password <br /></th>
86                 <td><input name=
"password" type="password" id="password" size="30" /></td>
87             </tr>
88             <tr>
89                 <th scope=
"row">&nbsp;</th>
90                 <td><input name=
"submit" type="submit" class="button" id="submit" value="Login" /></td>
91             </tr>
92             <tr>
93                 <th scope=
"row">&nbsp;</th>
94                 <td>&nbsp;</td>
95             </tr>
96             <tr>
97                 <th scope=
"row">&nbsp;</th>
98                 <td><strong><a href=
"forgotpassword.php">Forgot Password &gt;&gt;</a></strong></td>
99             </tr>
100         </table>
101     </form>
102     <p>&nbsp;</p>
103 </div>
104
105 <!-- wrap ends here -->
106 </div>
107 <?php
108
109 include(
"footer.php");
110 ?>


Gõ tìm kiếm nhanh...